import java.util.Scanner;

public class Main3 {


    //最长上升子序列（二）
    public int LIS (int[] a) {
        int n = a.length;
        int[] dp = new int[n+1];
        int pos = 0;
        for (int x: a) {
            if(pos == 0 || x>dp[pos]){
                dp[++pos] = x;
            }else{
                int l = 1,r = pos;
                while (l<r){
                    int mid = (l+r)/2;
                    if(dp[mid]>=x) r= mid;
                    else l = mid+1;
                }
                dp[l] = x;
            }
        }
        return pos;
    }










    //消减整数
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int t = in.nextInt();
        while(t-- != 0){
            int h = in.nextInt();
            int ret = 0,a=1;
            while(h!=0){
                h-=a;
                ret++;
                if(h%(a*2) == 0){
                    a*=2;
                }
            }
            System.out.println(ret);
        }
    }







    //排序子序列
    public static void main1(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int[] arr = new int[n];
        for (int i = 0; i < n; i++) {
            arr[i] = in.nextInt();
        }
        int ret = 0,i=1;
        while(i<n){
            if(i == n-1){
                ret++;
                break;
            }
            if(arr[i] < arr[i+1]){
                while(i+1 < n && arr[i] <= arr[i+1]) i++;
                ret++;
            }else if(arr[i] >arr[i+1]){
                while(i+1 < n && arr[i] >= arr[i+1]) i++;
                ret++;
            }else{
                while(i+1 < n && arr[i] == arr[i+1]) i++;
            }
            i++;
        }
        System.out.println(ret);
    }





}
